GBML manual / Backgrounds

tile_layer_palette

Draws the tiles of the room you are in, its floor and walls, in the colors of a palette instead of the colors of the tileset they were painted with. tile_layer_palette(nothing) puts the tileset’s own colors back.

Works differently on Game Boy - The Game Boy has 4 shades of grey, and the picture shares one palette of them with the letters; sprites have two palettes of 3 shades and clear, so a recolor can only change which of the 4 shades each of the picture's 4 shades shows.

Works differently on Game Boy Color - The Game Boy Color has 8 palettes for sprites and 8 for the picture, each with 4 colors, so a palette of 16 colors recolors the picture by color number, and two colors of a crowded picture can share one.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

tile_layer_palette(palette)

Arguments

NameType
palettepalette

Returns

Nothing.

Description

Draws the tiles of the room you are in - its floor and walls - in the colors of a palette instead of the colors of the tileset they were painted with. tile_layer_palette(nothing) puts the tileset's own colors back.

It recolors every tile layer the room has, for as long as the room stays loaded. Leave the room or restart it and the room starts with its own colors again, so call it from the room's creation code or an object's Create event if you want it every time. If the room has a Room Palette set in Room Properties (or with Set palette in the Tile Palette, which is the same setting), the room starts with that one instead of the tileset's own, and it is there every time the room loads.

It does nothing in a room with no tiles. The palette has to have 16 colors.

This is not the same thing as tile_layer_set_active, which switches between the collision layers you drew. This one only changes colors.

Example

// Create event: the room at dusk
tile_layer_palette(pal_doc_gold);

The cost

The room's tiles use one of the console's 16 background palettes, and the palette you give them takes that place. If the console has none free a development build stops, and a release build leaves the tiles in their own colors.

On the GBA

It recolors every tile layer the room has, now and for as long as the room stays loaded: leave the room, or restart it, and the room starts with its own colors again, so call it from the room’s creation code (or an object’s Create event) if you want it every time. It does nothing in a room with no tiles. The palette has to have 16 colors. The room’s tiles use one of the console’s 16 background palettes, and a palette you give them takes that place instead. If the console has none free a development build stops with a message that says so, and a release build leaves the tiles in their own colors.

See also: Palettes - recoloring a picturebackground_palettezoom_background_palettetile_layer_set_activesprite_palette